﻿//
// Created by francklinson on 2021/3/31.
//

#include "emp.h"


abstr_emp::abstr_emp(const std::string &fn, const std::string &ln, const std::string &j)
{
    fname = fn;
    lname = ln;
    job = j;
}

void abstr_emp::ShowAll() const
{
    std::cout << "first name: " << fname << std::endl;
    std::cout << " last name: " << lname << std::endl;
    std::cout << " job: " << job << std::endl;
}

void abstr_emp::SetAll()
{
    fname = "none";
    lname = "none";
    job = "none";
}

std::ostream &operator<<(std::ostream &os, const abstr_emp &e)
{
    e.ShowAll();
    return os;
}

abstr_emp::~abstr_emp()
{
//    std::cout << "abstr_emp destructor" << std::endl;
}


void employee::ShowAll() const
{
    abstr_emp::ShowAll();
}

void employee::SetAll()
{
    abstr_emp::SetAll();
}

employee::~employee()
{
//    std::cout << "employee destructor" << std::endl;
}

manager::manager(const manager &m) : abstr_emp(m)
{
    inchargeof = m.inchargeof;
}

void manager::ShowAll() const
{
    abstr_emp::ShowAll();
    std::cout << " number of abstr_emps managed: " << InChargeOf() << std::endl;
}

void manager::SetAll()
{
    abstr_emp::SetAll();
    inchargeof = 0;
}

fink::fink(const fink &e) : abstr_emp(e)
{
    reportsto = e.reportsto;
}

void fink::ShowAll() const
{
    abstr_emp::ShowAll();
    std::cout << "reports to :" << ReportsTo() << std::endl;
}

void fink::SetAll()
{
    abstr_emp::SetAll();
    reportsto = "none";
}


void highfink::ShowAll() const
{
    fink::ShowAll();
//    manager::ShowAll();
    std::cout << "number of abstr_emps managed: " << manager::InChargeOf() << std::endl;
}

void highfink::SetAll()
{
    manager::SetAll();
    fink::SetAll();
}

